package org.triumphxx.springboot.beansearcher.controller;

import cn.zhxu.bs.BeanSearcher;
import cn.zhxu.bs.SearchResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.triumphxx.springboot.beansearcher.entity.StaffBean;
import org.triumphxx.springboot.beansearcher.utils.MapUtil;
import org.triumphxx.springboot.beansearcher.vo.StaffVO;

/**
 * @author: wangyp
 * @Date: 2023/7/23
 * @Time: 16:51
 * @Desc: 查询员工详细信息接口
 **/
@RestController
public class StaffController {
    @Autowired
    private BeanSearcher beanSearcher;

    @PostMapping("/query")
    public SearchResult<StaffVO>  getStaffS(@RequestBody  StaffBean staffBean){
        // 这里只写一行代码
        return beanSearcher.search(StaffVO.class, MapUtil.toMap(staffBean));
    }
}
